#include <iostream>

using namespace std;

typedef long long LL;

const int N = 4e4 + 10;
int p[N], cnt; bool st[N];
LL phi[N]; 
int n;

void get_prime()
{
	phi[1] = 1;
	for(int i = 2; i <= n; i++)
	{
		if(!st[i]) 
		{
			p[++cnt] = i;
			phi[i] = i - 1;
		}
		for(int j = 1; 1ll * i * p[j] <= n; j++)
		{
			int x = i * p[j];
			st[x] = true;
			if(i % p[j] == 0)
			{
				phi[x] = phi[i] * p[j];
				break;
			}
			else
			{
				phi[x] = phi[i] * (p[j] - 1);
			}
		}
	}
}

int main()
{
	cin >> n;
	get_prime();
	LL sum = 0;
//	for(int i = 1; i <= n; i++) cout << phi[i] << " ";
	for(int i = 1; i <= n - 1; i ++)
	{
		sum += phi[i];
	}
    if(n == 1) cout << 0 << endl;
	else cout << 2 * sum + 1 << endl;
	return 0;
}
